package com.yc.jpyy.base.bean;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSON;

public class RestResponse extends BaseBean {

	/** 
	 * @Fields serialVersionUID : TODO()
	 */
	private static final long serialVersionUID = -1599411678301387889L;

	private int ReturnCode = -1;
	
	private Object ListData = null;

	private int TotalPage = -1;

	private int TotalCount = -1;

	private String ReturnMsg = "操作成功";//返回信息成功 或者 失败
	
	private String ReturnException;//返回异常信息
	
	private Object pubKey;
	
	private int PageNum = -1;
	
	public RestResponse(Object pubKey){
		setPubKey(pubKey);
	}

	public String getReturnException() {
		return ReturnException;
	}

	public void setReturnException(String returnException) {
		ReturnException = returnException;
	}

	public int getTotalPage() {
		return TotalPage;
	}

	public void setTotalPage(int totalPage) {
		TotalPage = totalPage;
	}

	

	public int getTotalCount() {
		return TotalCount;
	}

	public void setTotalCount(int TotalCount) {
		this.TotalCount = TotalCount;
	}

	public RestResponse() {
	}

	public RestResponse(int ReturnCode, Object ListData, String ReturnMsg, int FalgType) {
		this.ReturnCode = ReturnCode;
		this.ListData = ListData;
		this.ReturnMsg = ReturnMsg;
	}

	public int getReturnCode() {
		return ReturnCode;
	}

	public void setReturnCode(int returnCode) {
		ReturnCode = returnCode;
	}

	public Object getListData() {
		return ListData;
	}

	public void setListData(Object listData) {
		ListData = listData;
	}

	public String getReturnMsg() {
		return ReturnMsg;
	}

	public void setReturnMsg(String returnMsg) {
		ReturnMsg = returnMsg;
	}

	public void setReturnMsg(int ReturnCode, String ReturnMsg) {
		this.ReturnCode = ReturnCode;
		this.ReturnMsg = ReturnMsg;
	}

	public String toJSON() {
		Map<String, Object> map = new HashMap<String, Object>();
		if (this.getListData() != null) {
			map.put("ListData", ListData);
		}
		if (this.getTotalCount()!= -1) {
			map.put("TotalCount", this.getTotalCount());
		}
		if (this.getTotalPage() != -1) {
			map.put("TotalPage", this.getTotalPage());
		}

		if (this.getReturnCode() != -1) {
			map.put("returnCode", this.getReturnCode());

		}
		if (this.getReturnMsg() != "") {
			map.put("returnMsg", this.getReturnMsg());

		}
		
		if (this.getReturnException() != "") {
			map.put("returnException", this.getReturnException());

		}
		
		if ( this.getPubKey() !=  null ) {
			map.put("pubKey", this.getPubKey());
		}
		
		if ( this.getPageNum() != -1 ) {
			map.put("PageNum", this.getPageNum());
		}
		
		return JSON.toJSONString(map);
	}


	public Object getPubKey() {
		return pubKey;
	}


	public void setPubKey(Object pubKey) {
		this.pubKey = pubKey;
	}

	public int getPageNum() {
		return PageNum;
	}

	public void setPageNum(int pageNum) {
		PageNum = pageNum;
	}

}
